from pyecharts.charts import Funnel
from pyecharts import options as opts
from pyecharts.globals import ThemeType
from Test.dataSource.Data import data
data_xz = data.loc[data['NewlyAsymptomatic'] != 0, :]
a = data_xz["region"].to_list()
b = data_xz["NewlyAsymptomatic"].to_list()
# print([list(z) for z in zip(a, b)])
funnel = (
    Funnel(init_opts=opts.InitOpts(theme=ThemeType.LIGHT,
                                   width="700px",
                                   height="700px",
                                   ))
        .add(
        "无症状病例数",
        [list(z) for z in zip(a, b)],
        sort_="descending",  # 数据排序:下降
        label_opts=opts.LabelOpts(position="inside"),

    )
        .set_global_opts(
        title_opts=opts.TitleOpts(
            title="新增无症状数量情况",
            pos_top='10px',
            pos_left='40%',
            title_textstyle_opts=opts.TextStyleOpts(color='#CCFFFF', )),
        legend_opts=opts.LegendOpts(
            pos_top='35%',
            pos_left='10%',
            orient='vertical',  # 布局朝向:垂直
            is_show=False,

        ),
    )

)
funnel.render("../TestHTML/TestHtml-b/funnel_label_inside.html")
